package com.leezk.order.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.leezk.order.entity.Student;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderDto {
    private String id;

    private String sid;

    private Student student;

    private String deail;

    private List<OrderChild> orderChildrens;

    private String phone;

    private Boolean isPay;

    private BigDecimal price;
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//页面写入数据库时格式化
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date creatTime;
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//页面写入数据库时格式化
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class OrderChild{

        private Integer id;

        private String name;

        private Integer stock;

        private BigDecimal price;

        private BigDecimal total;

        private String img;
    }

}
